<!DOCTYPE html>
<html>
<head>
  @include('/common/header.html',{"title":"控制台"}){}
</head>
<body class="hold-transition login-page">
<div class="login-box">
  <div class="login-logo">
    <a href="../../index2.html">Epoch权限管理系统</a>
  </div>
  <!-- /.login-logo -->
  <div class="login-box-body">
    <p class="login-box-msg">登陆</p>

    <form method="post">
      <div class="form-group has-feedback">
        <input type="text" name="username" class="form-control" id="user_name" placeholder="账号">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" name="password" class="form-control" id="password" placeholder="密码">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      <div class="row">
        <div class="col-xs-8">
          <div class="checkbox icheck">
            <label>
              <input type="checkbox"> 记住我
            </label>
          </div>
        </div>
        <!-- /.col -->
        <div class="col-xs-4">
          <button type="button" class="btn btn-primary btn-block btn-flat" onclick="login()">登陆</button>
        </div>
        <!-- /.col -->
      </div>
    </form>
  </div>
  <!-- /.login-box-body -->
</div>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
<script type="text/javascript">
function login() {
    var user_name = $("#user_name").val();
    var password = $("#password").val();
    if(isEmpty(user_name)){
        $('#user_name').focus();
        return;
    }
    if(isEmpty(password)){
        $('#password').focus();
        return;
    }
    $.ajax({
		url : "${basePath}/login",
		data : $("form").serialize(),
		type : "post",
		success : function(data) {
			if (data.code == 0) {
                $(location).attr('href', '${basePath}/index/index');
            } else {
            }
		},
		error : function() {
		},
		async : false
	});
}
</script>
</body>
</html>
